package com.chencong.online.function;

import com.chencong.online.bean.OrderEventBean;
import com.chencong.online.bean.OrderResultBean;
import org.apache.flink.cep.PatternTimeoutFunction;

import java.util.List;
import java.util.Map;

/**
 * @program: user-behavior-analysis-online
 * @ClassName OrderPattternTimeoutFunc
 * @description:超时时间处理函数
 * @author: chencong
 * @create: 2022-01-05 18:18
 **/
public class OrderPatternTimeoutFunc implements PatternTimeoutFunction<OrderEventBean, OrderResultBean> {
    @Override
    public OrderResultBean timeout(Map<String, List<OrderEventBean>> pattern, long timeoutTimestamp) throws Exception {
        Long timeOutId = pattern.get("create").iterator().next().getOrderId();
        return new OrderResultBean(timeOutId, "超时时间" + timeoutTimestamp);
    }
}
